using Microsoft.VisualBasic.CompilerServices;
using SJVars;
using Spacejock;
using System;
using System.Collections;
using System.Runtime.CompilerServices;
using System.Threading;
using yW5Lib;

namespace yWriter6
{
	public class clsPrintCharList
	{
		public delegate void PrintProgressEventHandler(string ProgressString);

		[CompilerGenerated]
		private PrintProgressEventHandler PrintProgressEvent;

		public event PrintProgressEventHandler PrintProgress
		{
			[CompilerGenerated]
			add
			{
				PrintProgressEventHandler printProgressEventHandler = PrintProgressEvent;
				PrintProgressEventHandler printProgressEventHandler2;
				do
				{
					printProgressEventHandler2 = printProgressEventHandler;
					PrintProgressEventHandler value2 = (PrintProgressEventHandler)Delegate.Combine(printProgressEventHandler2, value);
					printProgressEventHandler = Interlocked.CompareExchange(ref PrintProgressEvent, value2, printProgressEventHandler2);
				}
				while ((object)printProgressEventHandler != printProgressEventHandler2);
			}
			[CompilerGenerated]
			remove
			{
				PrintProgressEventHandler printProgressEventHandler = PrintProgressEvent;
				PrintProgressEventHandler printProgressEventHandler2;
				do
				{
					printProgressEventHandler2 = printProgressEventHandler;
					PrintProgressEventHandler value2 = (PrintProgressEventHandler)Delegate.Remove(printProgressEventHandler2, value);
					printProgressEventHandler = Interlocked.CompareExchange(ref PrintProgressEvent, value2, printProgressEventHandler2);
				}
				while ((object)printProgressEventHandler != printProgressEventHandler2);
			}
		}

		public void PrintCharList(clsProject cProject)
		{
			//Discarded unreachable code: IL_0384, IL_039b, IL_03a6, IL_03b6, IL_0498, IL_049a, IL_04ae, IL_04d0
			int num = default(int);
			int num3 = default(int);
			try
			{
				ProjectData.ClearProjectError();
				num = 2;
				int num2 = 2;
				clsShared.cSubs.BusyMouse();
				num2 = 3;
				clsReport clsReport = new clsReport(ref clsShared.cLog, ref clsShared.cSettings, "Character List");
				num2 = 4;
				clsReport.AddTitle();
				num2 = 5;
				clsReport.AddCentered(cProject.Title + " by " + cProject.AuthorName);
				num2 = 6;
				clsReport.AddBR(2);
				num2 = 7;
				clsReport.SetTableBorder(0);
				num2 = 8;
				clsReport.OpenTable();
				num2 = 9;
				clsReport.SetTableWidth((int)Math.Round((double)clsReport.TableWidth / 2.0));
				num2 = 10;
				IEnumerator enumerator = cProject.Chars.GetEnumerator();
				while (enumerator.MoveNext())
				{
					clsCharacter clsCharacter = (clsCharacter)enumerator.Current;
					num2 = 11;
					clsReport.OpenRow();
					num2 = 12;
					clsReport.OpenCell("maxwidth=70%");
					num2 = 13;
					clsReport.OpenTable("cellpadding=5");
					num2 = 14;
					clsReport.OpenRow();
					num2 = 15;
					clsReport.AddCell("Name: <b>" + clsCharacter.Title + "</b> (AKA: " + clsCharacter.AKA + ")", clsReport.Class_Header + " width=50%");
					num2 = 16;
					clsReport.AddCell("Full Name: <b>" + clsCharacter.FullName + "</b>", clsReport.Class_Header + " width=50%");
					num2 = 17;
					clsReport.CloseRow();
					num2 = 18;
					clsReport.OpenRow();
					num2 = 19;
					clsReport.AddCell("Bio: " + clsCharacter.Bio, clsReport.Class_Header + " width=50%");
					num2 = 20;
					clsReport.AddCell("Goals: " + clsCharacter.Goals, clsReport.Class_Header + " width=50%");
					num2 = 21;
					clsReport.CloseRow();
					num2 = 22;
					clsReport.OpenRow();
					num2 = 23;
					clsReport.AddCell("Notes: " + clsCharacter.Notes, clsReport.Class_Header + " width=50%");
					num2 = 24;
					clsReport.AddCell("Desc: " + clsCharacter.DescText, clsReport.Class_Header + " width=50%");
					num2 = 25;
					clsReport.CloseRow();
					num2 = 26;
					clsReport.CloseTable();
					num2 = 27;
					clsReport.CloseCell();
					num2 = 28;
					clsReport.OpenCell("maxwidth=30%");
					num2 = 29;
					clsReport.OpenTable("cellpadding=5");
					num2 = 30;
					clsReport.OpenRow();
					num2 = 31;
					clsReport.OpenCell();
					num2 = 32;
					clsReport.AddImage(cProject.ImagesFolder, clsCharacter.ImageFile, SuppressMissingText: false);
					num2 = 33;
					clsReport.CloseCell();
					num2 = 34;
					clsReport.CloseRow();
					num2 = 35;
					clsReport.CloseTable();
					num2 = 36;
					clsReport.CloseCell();
					num2 = 37;
					clsReport.CloseRow();
					num2 = 38;
					clsReport.OpenRow();
					num2 = 39;
					clsReport.OpenCell("colspan=2");
					num2 = 40;
					clsReport.AddText("<hr>");
					num2 = 41;
					clsReport.CloseCell();
					num2 = 42;
					clsReport.CloseRow();
					num2 = 43;
				}
				num2 = 44;
				if (enumerator is IDisposable)
				{
					(enumerator as IDisposable).Dispose();
				}
				num2 = 45;
				clsReport.CloseTable();
				num2 = 46;
				clsReport.AddFooter(App.Title);
				num2 = 47;
				clsReport.Show();
				num2 = 48;
				PrintProgressEvent?.Invoke("Printing Complete");
				num2 = 49;
				clsShared.cSubs.NormalMouse();
			}
			catch (Exception obj) when ((num != 0) & (num3 == 0))
			{
				ProjectData.SetProjectError(obj);
				/*Error near IL_04ce: Could not find block for branch target IL_049a*/;
			}
			if (num3 != 0)
			{
				ProjectData.ClearProjectError();
			}
		}
	}
}
